﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class Student
    {
        public int _age;
        public int Age
        {
            get { return _age; }
            set
            {
                if (value >= 18 && value <= 50)
                { _age = value; }
                else { value = 0; }
            }
        }
        public String Name { get; set; }
        public int _score;
        public int Score
        {
            get { return _score; }
            set
            {
                if (value > 60) {
                   _score=value;
                    Console.WriteLine("恭喜你，及格了"); }
                else { Console.WriteLine("对不起你挂科了"); }

            }
        }
        
        public Student(int age, String name, int score)//这里的age,name,score都是形参
        {
            Age = age;
            Name = name;
            Score = score;
        }
        public void Input()
        {
            Console.WriteLine("年龄:{0},名字:{1},成绩:{2}", Age, Name, Score);
        }
        public Student(int aas, string name1) : this(aas, name1, 0)//若有调用0，则0是实参，aas,name1是形参
        {

        }
        public Student(int ass) : this(ass, "懒羊羊", 61)//懒羊羊，61是实参，ass是形参
        {

        }
      

     
        ~Student()
        {
            Console.WriteLine("这是个西沟函数");
        }
    }
}
